package shutdwon;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author aiowang
 * @description:
 * @date 2020/9/22 21:12
 */
public class TestThread2 {
    public static void main(String[] args) {
        while (true) {
            ExecutorService service = Executors.newFixedThreadPool(1);
            try {
                service.submit(new Runnable() {
                    public void run() {
                        try {
                            Thread.sleep(2000);
                        } catch (InterruptedException e) {
                        }
                    }
                });
            } catch (Exception e) {
            }finally{
                service.shutdown();
            }
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
            }
        }
    }
}
